<template>
  <div class="home">
    <img
      alt="Vue logo"
      src="../assets/logo.png"
      @click="changeUserName"
    >
    <p>{{userName}}</p>
    <HelloWorld msg="Welcome to Your Vue.js App" />
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'

export default {
  name: 'home',
  components: {
    HelloWorld
  },
  computed: {
    test() {
      return this.$store.getters.testGetter
    },
    userName() {
      return this.$store.state.user.userName
    }
  },
  mounted() {
    console.log(this.$getDeviceInfo())
    console.log(this.$api)
    console.log(window.md5('123'))
  },
  methods: {
    changeUserName() {
      this.$store.dispatch('setUserName', 3)
    }
  }
}
</script>
<style scoped lang="scss">
.home {
  img {
    width: 100%;
  }
}
</style>

